home *** CD-ROM | disk | FTP | other *** search
/ Commodore Free 4 / Commodore_Free_Issue_04_2007_Commodore_Computer_Club.d64 / t.a eeeben < prev    next >
Text File  |  2023-02-26  |  5KB  |  186 lines

  1. u
  2.  
  3. Interview with Aleksi Eeeben
  4.  
  5. 1) Emulation of a SID - a tough
  6. enough job to do on PC, but how on
  7. earth can someone even think of bring
  8. the sound of the 64 into the
  9. unexpanded 5 KB of the VIC-20?
  10.  
  11. Common sense says it's not possible,
  12. so it had to be done with a little
  13. madness. No, it's not really a trick,
  14. but actually a quite faithful emulation
  15. of the inner workings of SID. Phase-
  16. accumulating oscillators  are very
  17. much the same. Everything is just
  18. scaled down to such accuracy and
  19. detail that a 1 MHz 8-bit processor
  20. can handle.
  21.  
  22. 2) Could you explain how you managed
  23. to make this happen to someone who
  24. does not understand that much of coding
  25. like - well, let's say ... a nerd  like me?
  26.  
  27. The emulation consists of four parts:
  28.  
  29. 1. Tone generator - The heart of the
  30. emulation, generates and mixes  three
  31. static voices and outputs the combined
  32. sound through volume register  4-bit
  33. DAC (exactly like playing samples on
  34. C-64). Triangle, sawtooth, pulse  Wave
  35. (with 32 widths) and noise can be
  36. selected with a jmp-switch and each
  37. voice has volume setting of 0-7. This
  38. code is running in an NMI timer
  39. interrupt called at 6.1 kHz rate.
  40. Locating the entire tone generator part
  41. on zeropage, using self-modifying
  42. code and counting cycles, I squeezed
  43. the  oscillator code to 30-39 cycles
  44. per voice (depending on waveform), so
  45. there's a  few cycles left for other
  46. routines too.
  47.  
  48. 2. Original playroutine - 6502 and
  49. 6510 share the same instruction set,
  50. so the same original routine from C-64
  51. can be used directly. For VIC 20, all
  52. writes to SID chip must be manually
  53. patched to some other memory location,
  54. since $D400-$D418 is ROM.
  55.  
  56. Also zeropage usage must be checked,
  57. as almost entire zeropage is used by
  58. the tone generator part. Luckily most
  59. playroutines need only a few zero page
  60. locations. And finally, if the play
  61. routine itself is located under VIC
  62. 20 ROM's then it has to be  relocated
  63. somewhere else.
  64.  
  65. 3. Register emulation and envelopes -
  66. This routine is called in sync with the
  67. playroutine. It's linked to IRQ and
  68. called only once a frame (50  Hz). It
  69. simply reads the SID register image
  70. produced by the playroutine part and
  71. then changes the inner state of the
  72. tone generator accordingly. Sid Vicious
  73. internal frequency values are SID-
  74. frequency divided by a constant.
  75. Waveform jmp-switches are set based
  76. on SID image waveform registers. This
  77. part also emulates the envelopes and
  78. updates the level bits in tone
  79. generator code. Gate bits are polled &
  80. attack/release phases started as
  81. required.
  82.  
  83. 4. Noise emulation - Voices with noise
  84. waveform read from a 16-sample buffer.
  85. The buffer is constantly filled with
  86. new random numbers whenever there is
  87. free processor time.
  88.  
  89. 3) Nevertheless the routine has to have
  90. some kind of magic to it  because you
  91. state that on the 64 it could be used
  92. to play 2-SID-Songs on just one  SID -
  93. now that is awkward because we are
  94. talking about six voices here instead
  95. of three.
  96.  
  97. What's the trick and how much
  98. memory does that trick need, or in
  99. other words: can we hope for someone
  100. doing a six-voice-tune for a upcoming
  101. game in the distant future?
  102.  
  103. On C-64 you can play 3 regular SID
  104. voices and 3 emulated voices. The
  105. emulated voices will take
  106. approximately 50-70% of CPU time,
  107. which makes  it unsuitable for most
  108. games. It's possible if your game is
  109. not very CPU-intensive, but generally
  110. it's probably better for title screens
  111. and such.
  112.  
  113. The emulated voices are always
  114. sounding a little rougher. Low- and
  115. mid-range notes with pulse waveform
  116. sound best, very authentic actually. So
  117. arrange your basses, lower leads and
  118. not-too-high pads in the emulated
  119. voices.  Also experiment with drums.
  120. The emulated voices have a sharper
  121. attack. Also  the noise has a certain
  122. unique character, although it can't
  123. reach as high as SID.
  124.  
  125. 4) Generally speaking: more memory,
  126. more voices? Can this be topped by a
  127. 128 playing 9 voices or is 6 the limit
  128. for the SID to manage/emulate?
  129.  
  130. It's not really a matter of memory. On
  131. C-128 you could probably use the 2
  132. MHz mode for doubling the mixing
  133. rate to 12 kHz. 3 SID voices and 6 
  134. Emulated voices is possible, but you
  135. need to rewrite the tone generator code
  136. for high memory instead of zeropage
  137. and this decreases the performance.
  138.  
  139. Pulse waveform is the fastest to
  140. emulate, since it doesn't require a
  141. table-lookup for the envelope levels
  142. (level can be implemented directly
  143. by changing the values of upper and
  144. lower edge). VIC 20 NMI's waste a
  145. few cycles because they jump through
  146. ROM. Thus, 4 emulated pulse wave
  147. voices should be doable on C-64 with
  148. similar quality.
  149.  
  150. Sid Vicious sound examples recorded
  151. from VICExvic:
  152.  
  153. www.cncd.fi/aeeben/temp/vic20-sid-
  154.      emu-upsidedown.mp3
  155.  
  156. www.cncd.fi/aeeben/temp/vic20-sid-
  157.      emu commando.mp3
  158.  
  159. www.cncd.fi/aeeben/temp/vic20-sid-
  160.      emu-zoids.mp3
  161.  
  162. www.cncd.fi/aeeben/temp/vic20-sid-
  163.      emu-uuno.mp3
  164.  
  165. These run in VICE xvic (remove all
  166. extra memory and reset emulator Before
  167. loading):
  168.  
  169.   www.cncd.fi/aeeben/temp/upside.prg
  170.  
  171.   www.cncd.fi/aeeben/temp/zoids.prg
  172.  
  173. The source code, work in progress:
  174.   www.cncd.fi/aeeben/temp/sidemu_sou
  175.      rce_v0.zip
  176.  
  177. Other stuff:
  178.  
  179.   www.myspace.com/aleksieeben
  180.  
  181.   www.cncd.fi/aeeben
  182.  
  183. interview printed with Permission from
  184. http://www.cevi-aktuell.de.vu/ Magazine
  185.  
  186.